home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / MISC / AUDIO.ZIP / SETUP.ASM < prev   
Encoding:
Assembly Source File  |  1993-12-11  |  2.6 KB  |  78 lines

  1. *
  2. *   SETUP.ASM - Perform basic initializations, setup AIC chip,
  3. *               provide commonly used defines.
  4. *
  5. AIC_CNTA    .set    01830h  ; filter cutoff approx. 5200 (TA=RA=12)
  6. AIC_CNTB    .set    02c5ah  ; sample rate 18939 (TB=RB=22)
  7. AIC_CTRL    .set    00043h  ; bandpass filter off, unity gain
  8. DRR         .set    0
  9. DXR         .set    1
  10. TIM         .set    2
  11. PRD         .set    3
  12. IMR         .set    4
  13. GREG        .set    5
  14. B2_D        .set    060h
  15. B0_D        .set    0200h
  16. B1_D        .set    0400h
  17. B3_D        .set    0600h
  18. B0_P        .set    0FA00h
  19. B1_P        .set    0FC00h
  20. B3_P        .set    0FE00h
  21.  
  22. *
  23. *   Secondary interrupt vector table in program RAM
  24. *
  25.         .ps     0fa00h
  26.         B       go          ; reset
  27.         B       go          ; INT0
  28.         B       go          ; INT1
  29.         B       go          ; INT2  (DSKD load ignores INT2 vector)
  30.         B       tint        ; timer interrupt
  31.         B       rint        ; AIC recv interrupt
  32.         B       xint        ; AIC xmit interrupt
  33.  
  34. *
  35. *                               go
  36. *
  37. *   Initial entry point for DSK audio demos.  Performs various
  38. *   initializations and then jumps to "main"
  39. *
  40.         .ps     0FB00h
  41.         .entry
  42. go:
  43.         ldpk    0           ; data page 0 for mem mapped regs and B2
  44.         conf    1           ; select memory map
  45.         sovm                ; accum saturates on overflow
  46.         fort    0           ; serial port in 16 bit mode
  47.         rtxm                ; external xmit frame sync
  48.         sfsm                ; external recv frame sync
  49.         lack    024h        ; briefly enable xmit interrupt
  50.         eint                ; enable interrupts
  51.         sacl    IMR         ; store at interrupt mode reg
  52.         lalk    AIC_CNTA    ; get word for counter A reg
  53.         call    wr_aic_reg
  54.         lalk    AIC_CNTB    ; get word for counter B reg
  55.         call    wr_aic_reg
  56.         lalk    AIC_CTRL    ; get word for ctrl reg
  57.         call    wr_aic_reg
  58.         dint
  59.         b       main
  60.         
  61. *
  62. *                           wr_aic_reg
  63. *
  64. *   Performs secondary transmit operation to write to config
  65. *   registers at AIC chip.  Passed register value in ACCUM.
  66. *   Xmit interrupts must be enabled before calling.
  67. *
  68. wr_aic_reg:
  69.         idle                ; wait for xmit request
  70.         lark    AR0,3       ; low 2 bits set request secondary xmit
  71.         sar     AR0,DXR 
  72.         idle                ; wait for secondary xmit request
  73.         sacl    DXR         ; write the register
  74.         idle
  75.         zac                 ; low 2 bits clear to go back to normal
  76.         sacl    DXR
  77.         ret
  78.